import QtQuick 2.6
import QtQuick.Layouts 1.2

import "../../Base/UiBase"
import "../../Base/Config"

import Data 1.0

Rectangle {
    id: root

    color: Color.background

    MouseArea {
        z:-1
        anchors.fill: parent
    }

    ColumnLayout {
        anchors.fill: parent
        spacing: 0

        // header
        Rectangle {
            Layout.fillWidth: true
            Layout.preferredHeight: 96 * Size.ratio
            color: Color.foreground

            // back button
            ImageButton {
                width: 80 * Size.ratio
                height: 96 * Size.ratio
                anchors.left: parent.left
                anchors.verticalCenter: parent.verticalCenter
                source: "../../../resources/comment/fanhiu01.svg"

                onClicked: root.visible = false
            } // end back button

            Text {
                anchors.centerIn: parent
                text: qsTr("设置")
                color: Color.input
                font.pixelSize: Size.titleFont
            }
            BottomDivider{}
        } // end header
        Item {
            Layout.fillWidth: true
            Layout.preferredHeight: 20 * Size.ratio
        }

        // body
        Flickable {
            Layout.fillWidth: true
            Layout.fillHeight: true
            Column {
                id:row
                width: root.width
                Rectangle {
                    width: parent.width
                    height: 90 * Size.ratio
                    Text {
                        x: 40 * Size.ratio
                        anchors.verticalCenter: parent.verticalCenter
                        text: qsTr("账号信息")
                        font.pixelSize: Size.font32
                    }
                    MouseArea {
                        anchors.fill: parent
                        onClicked: ;
                    }
                }

                Item {
                    width: parent.width
                    height: 20 * Size.ratio
                }

                Rectangle {
                    width: parent.width
                    height: 90 * Size.ratio
                    Text {
                        x: 40 * Size.ratio
                        anchors.verticalCenter: parent.verticalCenter
                        text: qsTr("消息推送")
                        font.pixelSize: Size.font32
                    }
                    SvgzImage{
                        anchors.verticalCenter: parent.verticalCenter
                        anchors.right: parent.right
                        anchors.rightMargin: 40 * Size.ratio
                        width: 100 * Size.ratio
                        height: 40 * Size.ratio
                        source: Setting.messagePushing ? "../../../resources/personal/setting/kai.svg" : "../../../resources/personal/setting/guan.svg"
                    }
                    MouseArea {
                        anchors.fill: parent
                        onClicked: Setting.messagePushing = !Setting.messagePushing;
                    }
                    BottomDivider{}
                }
                Rectangle {
                    width: parent.width
                    height: 90 * Size.ratio
                    Text {
                        x: 40 * Size.ratio
                        anchors.verticalCenter: parent.verticalCenter
                        text: qsTr("陌生人私信")
                        font.pixelSize: Size.font32
                    }
                    SvgzImage{
                        anchors.verticalCenter: parent.verticalCenter
                        anchors.right: parent.right
                        anchors.rightMargin: 40 * Size.ratio
                        width: 100 * Size.ratio
                        height: 40 * Size.ratio
                        source: Setting.strangerMessage ? "../../../resources/personal/setting/kai.svg" : "../../../resources/personal/setting/guan.svg"
                    }
                    MouseArea {
                        anchors.fill: parent
                        onClicked: Setting.strangerMessage = !Setting.strangerMessage;
                    }
                }

                Item {
                    width: parent.width
                    height: 20 * Size.ratio
                }

                Rectangle {
                    width: parent.width
                    height: 90 * Size.ratio
                    Text {
                        x: 40 * Size.ratio
                        anchors.verticalCenter: parent.verticalCenter
                        text: qsTr("邀请好友使用特长圈")
                        font.pixelSize: Size.font32
                    }
                    MouseArea {
                        anchors.fill: parent
                        onClicked: ;
                    }
                    BottomDivider{}
                }

                Rectangle {
                    width: parent.width
                    height: 90 * Size.ratio
                    Text {
                        x: 40 * Size.ratio
                        anchors.verticalCenter: parent.verticalCenter
                        text: qsTr("用户反馈")
                        font.pixelSize: Size.font32
                    }
                    MouseArea {
                        anchors.fill: parent
                        onClicked: ;
                    }
                    BottomDivider{}
                }

                Rectangle {
                    width: parent.width
                    height: 90 * Size.ratio
                    Text {
                        x: 40 * Size.ratio
                        anchors.verticalCenter: parent.verticalCenter
                        text: qsTr("版本更新")
                        font.pixelSize: Size.font32
                    }
                    MouseArea {
                        anchors.fill: parent
                        onClicked: ;
                    }
                    BottomDivider{}
                }

                Rectangle {
                    width: parent.width
                    height: 90 * Size.ratio
                    Text {
                        x: 40 * Size.ratio
                        anchors.verticalCenter: parent.verticalCenter
                        text: qsTr("关于我们")
                        font.pixelSize: Size.font32
                    }
                    MouseArea {
                        anchors.fill: parent
                        onClicked: ;
                    }
                    BottomDivider{}
                }

                Rectangle {
                    width: parent.width
                    height: 90 * Size.ratio
                    Text {
                        x: 40 * Size.ratio
                        anchors.verticalCenter: parent.verticalCenter
                        text: qsTr("清除缓存")
                        font.pixelSize: Size.font32
                    }
                    MouseArea {
                        anchors.fill: parent
                        onClicked: ;
                    }
                    BottomDivider{}
                }

            }
        } // end body

        // exit button
        Item {
            Layout.alignment: Qt.AlignBottom
            Layout.fillWidth: true
            Layout.preferredHeight: 100 * Size.ratio
            Layout.bottomMargin: 130 * Size.ratio
            Rectangle {
                width: 360 * Size.ratio
                height: 100 * Size.ratio
                anchors.horizontalCenter: parent.horizontalCenter
                color: Color.main
                radius: 10 * Size.ratio
                Text {
                    anchors.centerIn: parent
                    color: Color.foreground
                    font.pixelSize: Size.font32
                    text: qsTr("退出账号")
                }

                MouseArea {
                    anchors.fill: parent
                    onClicked: ; // TODO:
                }
            }
        } // end exit button

    }
}
